#ifndef CUSTOMITEMDELEGATE_H
#define CUSTOMITEMDELEGATE_H

#include <QMessageBox>
#include <QApplication>
#include <QStyledItemDelegate>
#include <QPainter>
#include <QMouseEvent>
#include "delewidget.h"
#include "custommodel.h"
class customItemDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    customItemDelegate(QObject* parent = nullptr,CustomModel *model=nullptr);

    void paint(QPainter* painter, const QStyleOptionViewItem& option,const QModelIndex& index) const override;
    QSize sizeHint(const QStyleOptionViewItem& option,const QModelIndex& index) const override;
    bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option,const QModelIndex& index) override;

signals:
    void sig_btnClicked(const QModelIndex& index);
public slots:
    void slots_btnClicked(const QModelIndex& index);

private:
    QScopedPointer<ItemButton> itemButton1;
    QPoint mousePos;
    CustomModel *m_CustomModel;

};

#endif // CUSTOMITEMDELEGATE_H

